<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        td {
            width: 20px;
            height: 20px;
            border: 1px solid #000;
        }
    </style>
</head>

<body>
    <table id="mytable"></table>

    <script>
        //请动态创建一个20行12列的表格
        var mytable = document.getElementById('mytable');
        //创建tr行
        for (var i = 0; i < 20; i++) {
            var tr = document.createElement('tr');
            //创建td列
            for (var j = 0; i < 12; j++) {
                var td = document.createElement('td');
                //让tr追加td
                tr.appendChild(td);
            }
            //让myTable追加tr标签
            mytable.appendChild(tr);
        }
    </script>
</body>

</html>